<?php
require_once 'lib/Path.php';
require_once Path::getPath('libraries').'Session.php';
require_once Path::getPath('libraries').'Rewrite.php';
require_once Path::getPath('libraries').'Template.php';
require_once Path::getPath('libraries').'SystemInterface.php';
require_once Path::getPath('libraries').'Actionable.php';
require_once Path::getPath('libraries').'FormComunication.php';
require_once Path::getPath('libraries').'Input.php';
require_once Path::getPath('libraries').'Support.php';
require_once Path::getPath('transaction').'Transaction.php';
require_once Path::getPath('root').'DataBaseFactory.php';

$path_info = $_SERVER['PATH_INFO'];
list( , $interface_alias, $rest) = explode ( '/', $path_info, 3);
$uri_array = explode('/', $rest);

$interface_info = Rewrite::getInterface($interface_alias);
require_once Path::getPath($interface_info['path']) . $interface_info['interface'] . '.php';

$interface = new $interface_info['interface'];

//echo memory_get_usage();

echo $interface->serviceHandler($uri_array);

/*$b = new DataBaseFactory(new Transaction);

$a = new Transaction();
$a->id = 16;
$a->delete();

$b->selectAllObjects();
    $tpl = new Template();

while ($obj = $b->fetch()){
    $tpl->add('description',$obj->description);
    $tpl->add('amount',$obj->amount);
}
    $tpl->display('prueba.tpl');

//print_r($b->getAllObjects());


/*$a->id = 18;
$a->owner = 1;
$a->account= 1;
$a->description = 'Updated ';
$a->amount = 1001;
$a->date = "2011-01-27";
$a->label = 'updated';

$a->save();*/
//$a->getAllObjects();

/*

$smarty = new Smarty_new();

$smarty->testInstall();

$smarty->assign('nombre','Juan');
$smarty->display('template.tpl');
*/




?>
